package net.lab1024.sa.admin.config;

import net.lab1024.sa.admin.module.business.category.domain.entity.UserContext;
import org.springframework.stereotype.Component;

@Component
public class UserContextHolder {
    private static final ThreadLocal<UserContext> USER_CONTEXT = new ThreadLocal<>();
    
    public static void setUserContext(UserContext userContext) {
        USER_CONTEXT.set(userContext);
    }
    
    public static UserContext getUserContext() {
        return USER_CONTEXT.get();
    }
    
    public static void clear() {
        USER_CONTEXT.remove();
    }
}

